<?php
/* 
 * This file is part of the CollegePress plugin suite.
 */


function collegepress_menu_home(){

 // variables for the field and option names 
    $opt_name = 'cp_classified_ads';
    $hidden_field_name = 'cp_submit_hidden';
    $data_field_name = 'cp_enable_classified_ads';

    // Read in existing option value from database
    $opt_val = get_option( $opt_name );

    // See if the user has posted us some information
    // If they did, this hidden field will be set to 'Y'
    if( $_POST[ $hidden_field_name ] == '1' ) {
        // Read their posted value
        $opt_val = $_POST[ $data_field_name ];

        // Save the posted value in the database
        update_option( $opt_name, $opt_val );

        // Put an options updated message on the screen



?>
<div id="message" class="updated fade"><p><strong><?php _e('Options saved.' ); ?></strong></p></div>
<?php

	}
?>
	<div class="wrap">

	<h2> <?php _e( 'CollegePress Home' ); ?> </h2>
	
	<form name="form1" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
	<input type="hidden" name="<?php echo $hidden_field_name; ?>" value="1">
	
	<p><?php _e("Enable Classifieds:" ); ?> 
	<input type="checkbox" name="<?php echo $data_field_name; ?>" <?php if (get_option($opt_name)) echo "checked='checked'"; ?> />
	</p><hr />
	
	<p class="submit">
	<input type="submit" name="Submit" value="<?php _e('Update Options') ?>" />
	</p>
	
	</form>
		
	</div>


<?php


}



?>